<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
	<head>
		<meta charset="UTF-8">
		<title>忘记密码-分销系统后台</title>
		<script th:src="@{/layui/layui.js}" type="text/javascript"></script>
		<link th:href="@{/layui/css/layui.css}" rel="stylesheet" />
	</head>
	<body class="layui-bg-gray">
		<div class="layui-bg-black" style="height: 50px;">
			<div style="float: left;color: #fff;font-size: 15pt;margin: 10px 20px;">
				分销商城后台
			</div>
		</div>
		<div class="layui-container">
			<div style="text-align: center;font-size: 30pt;
				margin: 70px 0px 50px 0px;font-weight: 30px;color: #000;">密码修改
			</div>
			<div class="layui-panel" style="border-radius: 5px;">
				<div style="height: 450px;text-align: center;">
					<div style="margin-top: 20px;font-size: 15px;color: #000;">
						<img th:src="@{/img/sendEmail.jpg}" style="width: 450px;height: 250px;" />
					</div>
					<div  style="width: 600px;text-align: center;margin: 10px auto;">
						<form class="layui-form layui-form-pane">
							<div class="layui-form-item layui-form-text">
								<!--<label class="layui-form-label">新密码</label>-->
								<div class="layui-input-block">
									<input style="height: 50px;" type="password" class="layui-input" name="newPwd" lay-verify="required" placeholder="输入新密码" autocomplete="off" />
								</div>
							</div>
							<div class="layui-form-item layui-form-text">
								<!--<label class="layui-form-label">确认密码</label>-->
								<div class="layui-input-block">
									<input style="height: 50px;" type="password" class="layui-input" name="confirmPwd" lay-verify="required|confirmPwd" placeholder="输入新密码" autocomplete="off" />
								</div>
							</div>
							<input type="hidden" name="code" th:value="${code}" />
							<input type="hidden" name="id" th:value="${id}" />
							<input type="hidden" name="email" th:value="${email}" />
							<div style="margin: 20px auto;width: 600px;">
								<a class="layui-btn layui-btn-normal layui-btn-fluid" style="height: 45px;" lay-submit="" lay-filter="edit">确认修改</a>
							</div>
						</form>
					</div>
				</div>
			</div>
		</div>	
		<script>
			var $;
			layui.use(['form','layer','jquery'],function(){
				var form = layui.form,layer=layui.layer;
				$=layui.jquery;
				
				form.verify({
					confirmPwd:function (value) {
						if($('input[name="newPwd"]').val()!=value){
							return "两次密码输入不一致";
						}
					}
				})
				
				form.on('submit(edit)',function(data){
					var formData = data.field;
					$.ajax({
						type:'post',
						url:'/system/mc/editPwd',
						data:formData,
						dataType:'json',
						success:function (result){
							layer.alert(result.msg,{icon:1});
							if(result.is){
								window.location.href="/page/login";
							}
						}

					})
					
				})
			});
		</script>
	</body>
</html>
